﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using Telerik.Web.UI;
using System.Web.UI;
using KPIS.GERP.GAMS.DAL;
using KPIS.GERP.GAMS.MODEL;

namespace KPIS.GERP.GAMS.APP.App_UI.Forms
{
    public partial class ReportRds : System.Web.UI.Page
    {
        D_BGM_MAS_Source source = new D_BGM_MAS_Source();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                hReportType.Value = Request.QueryString["ReportName"];
                LoadYear();
                LoadBgmSource();

                if (hReportType.Value == "pp30")
                {
                    lblComment.Visible = true;
                }
                else
                {
                    lblComment.Visible = false;
                }
            }
        }

        private void LoadYear() {
            cmbYear.Items.Clear();
            List<string> year = new List<string>();
            string y = DateTime.Now.ToString("yyyy",new System.Globalization.CultureInfo("th-TH"));
            int n = Convert.ToInt32(y);
            n += 2;
            for(int i=0;i<5;i++)           
                year.Add((n - i).ToString());
            
            cmbYear.DataSource = year;
            cmbYear.DataBind();
            cmbYear.Items.Insert(0, new RadComboBoxItem(" < เลือกปี > ", ""));
        }

        private void LoadBgmSource()
        {
            cmbBgmSourceSeq.DataSource = source.GetList();
            cmbBgmSourceSeq.DataBind();
            cmbBgmSourceSeq.Items.Insert(0, new RadComboBoxItem(" < เลือกแหล่งเงิน > ", ""));
        }

        protected void cmbMonthly_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
        {
           // lblWarning.Visible = false;
           // if (cmbMonthly.SelectedValue == "") lblWarning.Visible = true;
        }

    }
}
